package com.heima.thread.simple;

public class ExctuorTest {
    /**
     * 主线程，主方法
     * @param args
     */
    public static void main(String[] args) {
        //1.thread类
        MyThread myThread=new MyThread();
        myThread.setName("myThread-");
        myThread.start();

        //runable
        MyRunable myRunable=new MyRunable();
        Thread thread1=new Thread(myRunable);
        thread1.setName("MyRunable-");
        thread1.start();

        MyRunable myRunable2=new MyRunable();
        Thread thread2=new Thread(myRunable2);
        thread2.setName("MyRunable-");
        thread2.start();

        //主线程
        System.out.println(Thread.currentThread().getName()+System.currentTimeMillis());
    }

    public static  class MyRunable implements Runnable{

        @Override
        public void run() {
            System.out.println(Thread.currentThread().getName()+System.currentTimeMillis());
        }
    }

    /**
     * 创建线程以thread类的方法
     */
    public static class MyThread extends Thread{
        @Override
        public void run() {
            System.out.println(Thread.currentThread().getName()+System.currentTimeMillis());
        }
    }
}
